home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / 0utils.lha / 0Utils / ExpandArgs.data < prev    next >
Text File  |  1995-08-30  |  2KB  |  106 lines

  1.  
  2. #ifdef TPLTER
  3.  
  4. ExpandArgs = {
  5.  
  6.     SHORT = {{ expand wildcards }};
  7.  
  8.     DESCRIPTION = {{
  9.     Does wildcard expansion of all arguments,
  10.     that contain wildcards and passing of all
  11.     other arguments.
  12.  
  13.     RESULT
  14.     -/-
  15.     }};
  16.  
  17.     BUGS = {{
  18.     ExpandArgs breaks on the first error
  19.     }};
  20.     //'ExpandArgs test c:b#? xyz' produced one guru
  21.     //$80000004 when compiled w/ OPTIMIZE !???
  22.  
  23.  
  24.     TODO = {{
  25.     !TESTING!
  26.     }};
  27.  
  28.     EXAMPLES = {{
  29.     > ExpandArgs c:f#? xyz
  30.     c:Filenote
  31.     xyz
  32.     }};
  33.  
  34.     SEEALSO = {{
  35.     dos.library/MatchFirst, dos.library/MatchNext
  36.     }};
  37.  
  38.     HISTORY = {{
  39.     12-02-95 b_noll created
  40.     20-02-95 b_noll restructured source
  41.     21-02-95 b_noll added version/format-prefix/offset
  42.     20-03-95 b_noll added args diagnostics
  43.     19-08-95 b_noll created .data file
  44.     30-08-95 b_noll 1.3 added breakcheck
  45.     }};
  46.  
  47.  
  48.     Template = "/A/M";
  49.     Arguments = {{
  50.     STRPTR *par;
  51.  
  52. #    define MYFLAGS        /* (APF_DOWILD|) APF_DODOT| APF_FollowHLinks| */ 0
  53. #    define LFORMAT "%s\n"
  54.     }};
  55.  
  56.     version = "1.3";
  57.  
  58.     body = {{
  59.         BPTR stdout;
  60.         LONG   error;
  61.         STRPTR pat;
  62.         //STRPTR lformat = LFORMAT;
  63. #        define lformat LFORMAT
  64.         int    i;
  65.         struct AnchorPath  *ap;
  66.         UBYTE  apb[sizeof (*ap) + 8 + MAXPATHLEN];
  67.         //UBYTE  buffer[MAXPATHLEN];
  68.  
  69.         retval = RETURN_OK;
  70.         stdout = Output();
  71.  
  72.         ap              = (void *)(((ULONG)apb + 7) & ~7);
  73.         ap->ap_Strlen     = MAXPATHLEN;
  74.         ap->ap_BreakBits  = 0;
  75.         ap->ap_FoundBreak = 0;
  76.         //ap->ap_ = ;
  77.  
  78.  
  79.         for (i = 0; (pat = argv->par[i]) && !BREAKCHECK(); i++) {
  80.  
  81.         ap->ap_Flags  = MYFLAGS;
  82.  
  83.         for (error = MatchFirst(pat, ap); error == 0; error = MatchNext(ap)) {
  84.             FPrintf (stdout, lformat, ap->ap_Buf);
  85.     //FPrintf(Output(), "%ld\n", j++);
  86.         } /* for */
  87.         MatchEnd(ap);
  88.  
  89.         if (error != ERROR_NO_MORE_ENTRIES) { /* abnormal error */
  90.             if ((error == ERROR_OBJECT_NOT_FOUND) && !(ap->ap_Flags & APF_ITSWILD)) {
  91.             FPrintf (stdout, lformat, pat);
  92.             } else {
  93.             retval = RETURN_ERROR;
  94.             break;
  95.             } /* if */
  96.         } /* if */
  97.         } /* for */
  98.  
  99.     }};
  100.  
  101. };
  102.  
  103. #endif
  104.  
  105.  
  106.